package com.tanhua.server.controller;

import com.tanhua.domain.db.Answers;
import com.tanhua.server.service.TestSoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 测灵魂
 */
@RestController
@RequestMapping("/testSoul")
public class TestSoulController {

	@Autowired
	private TestSoulService testSoulService;

	/**
	 * 接口名称：测灵魂-问卷列表
	 * 接口路径：GET/testSoul
	 */
	@GetMapping
	public ResponseEntity<Object> soulPaperList() {
		return testSoulService.soulPaperList();
	}

	/**
	 * 接口名称：测灵魂-提交问卷
	 * 接口路径：POST/testSoul
	 */
	@PostMapping
	public ResponseEntity<Object> submitSoulPaper(@RequestBody Map<String, List<Answers>> map) {
		return testSoulService.submitSoulPaper(map);
	}

	/**
	 * 接口名称：测灵魂-查看结果
	 * 接口路径：GET/testSoul/report/:id
	 */
	@GetMapping("/report/{id}")
	public ResponseEntity<Object> findReportList(@PathVariable("id") Long reportId) {
		return testSoulService.findReportList(reportId);
	}

}
